package com.sinosoft.vaccinetoai.server.business.chatchainrecord.getchatchainrecordlist.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sinosoft.vaccinetoai.dao.mapper.business.ChatChainRecordMapper;
import com.sinosoft.vaccinetoai.dao.po.business.ChatChainRecord;
import com.sinosoft.vaccinetoai.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import com.sinosoft.vaccinetoai.server.business.chatchainrecord.getchatchainrecordlist.io.GetChatChainRecordListIO;
import com.sinosoft.vaccinetoai.server.business.chatchainrecord.getchatchainrecordlist.vo.GetChatChainRecordListVO;
import com.sinosoft.vaccinetoai.server.business.chatchainrecord.getchatchainrecordlist.service.IGetChatChainRecordListService;

import javax.annotation.Resource;

/**
 * @ClassName: GetChatChainRecordListServiceImpl
 * @ClassNameExplain: 
 * @Description: 用户聊天链历史列表查询Service Impl
 * @author xiazhihao
 * @date 2023年12月18日 22:20
 */
@Slf4j
@Service("GetChatChainRecordListService")
public class GetChatChainRecordListServiceImpl implements IGetChatChainRecordListService {

	@Resource
	private ChatChainRecordMapper chatChainRecordMapper;

	@Override
	public GetChatChainRecordListVO getChatChainRecordList(GetChatChainRecordListIO io) throws Exception {
        GetChatChainRecordListVO vo = new GetChatChainRecordListVO();
		Page<ChatChainRecord> page = PageHelper.startPage(io.getPage(), io.getSize());
		io.setUserId(SecurityUtils.getPrincipal().getUserId());
		chatChainRecordMapper.listByIO(io);
		vo.setTotal(page.getTotal());
		vo.setRows(page.getResult());
		return vo;
	}
	
}